<template>
  <el-table :data="list" style="width: 100%;padding-top: 15px;">
    <el-table-column label="订单地址" min-width="100">
      <template slot-scope="scope">
        {{ scope.row.order_no | orderNoFilter }}
      </template>
    </el-table-column>
    <el-table-column label="价格" width="150" align="center">
      <template slot-scope="scope">
        ¥{{ scope.row.price | toThousandFilter }}
      </template>
    </el-table-column>
    <el-table-column label="支付结果" width="100" align="center">
      <template slot-scope="{row}">
        <el-tag :type="row.status | statusFilter">
          {{ row.status }}
        </el-tag>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
// import { transactionList } from '@/api/remote-search'

export default {
  filters: {
    statusFilter(status) {
      const statusMap = {
        success: 'success',
        pending: 'danger'
      }
      return statusMap[status]
    },
    orderNoFilter(str) {
      return str.substring(0, 30)
    }
  },
  data() {
    return {
      list: [{
        order_no: '上海市普陀区金沙江路 1518 弄',
        price: '45',
        status: 'pending'
      }, {
        order_no: '上海市普陀区金沙江路 1518 弄',
        price: '221',
        status: 'success'
      }, {
        order_no: '上海市普陀区金沙江路 1518 弄',
        price: '454',
        status: 'success'
      }, {
        order_no: '上海市普陀区金沙江路 1518 弄',
        price: '21',
        status: 'success'
      }]
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    // fetchData() {
    //   transactionList().then(response => {
    //     this.list = response.data.items.slice(0, 8)
    //   })
    // }
  }
}
</script>
